<?xml version="1.0"?>

<!--
This file is part of the CSharpOptParse .NET C# library
 
The library is hosted at http://csharpoptparse.sf.net

Copyright (C) 2005 by Andrew Robinson

This source code is open source, protected under the GNU GPL Version 2, June 1991
Please see http://opensource.org/licenses/gpl-license.php for information and
specifics on this license.
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="usage">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="section" minOccurs="1" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="section">
		<xs:complexType>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="section" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="para" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="list" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="arguments" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="options" minOccurs="0" maxOccurs="1"/>
			</xs:choice>
			<xs:attribute name="name" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="para">
		<xs:complexType mixed="true">
			<xs:sequence minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="list"/>
			</xs:sequence>			
		</xs:complexType>
	</xs:element>
	
	<xs:element name="list">
		<xs:complexType>
			<xs:choice minOccurs="1" maxOccurs="unbounded">
				<xs:element ref="list"/>
				<xs:element name="item" type="xs:string"/>
			</xs:choice>
			<xs:attribute name="type" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="ordered"/>
						<xs:enumeration value="unordered"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
		
	<xs:element name="arguments">
		<xs:complexType>
			<xs:sequence minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="argument"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="argument">
		<xs:complexType>
			<xs:sequence minOccurs="1" maxOccurs="1">
				<xs:element ref="description"/>
			</xs:sequence>
			<xs:attribute name="type" type="xs:string" use="required"/>
			<xs:attribute name="name" type="xs:string" use="required"/>
			<xs:attribute name="optional" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="True"/>
						<xs:enumeration value="False"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="description">
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="list"/>
				<xs:element ref="para"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="options">
		<xs:complexType>
			<xs:choice minOccurs="1" maxOccurs="1">
				<xs:element ref="category" minOccurs="1" maxOccurs="unbounded"/>
				<xs:element ref="option" minOccurs="1" maxOccurs="unbounded"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="category">
		<xs:complexType>
			<xs:sequence minOccurs="1" maxOccurs="1">
				<xs:element ref="option" minOccurs="1" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="name" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="option">
		<xs:complexType>
			<xs:sequence minOccurs="1" maxOccurs="1">
				<xs:element ref="names" minOccurs="1" maxOccurs="1"/>
				<xs:element name="valueType" minOccurs="0" maxOccurs="1"
					type="xs:string"/>
				<xs:element name="defaultValue" minOccurs="0" maxOccurs="1"
					type="xs:string"/>
				<xs:element ref="description" minOccurs="1" maxOccurs="1"/>
			</xs:sequence>
			<xs:attribute name="type" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="Flag"/>
						<xs:enumeration value="Incremental flag"/>
						<xs:enumeration value="Value required"/>
						<xs:enumeration value="Value optional"/>
						<xs:enumeration value="0 to many values accepted"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="names">
		<xs:complexType>
			<xs:sequence minOccurs="1" maxOccurs="1">
				<xs:element ref="name" minOccurs="1" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="name">
		<xs:complexType>
			<xs:attribute name="value" type="xs:string" use="required"/>
			<xs:attribute name="type" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="short"/>
						<xs:enumeration value="long"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
</xs:schema>
